package net.nohaven.proj.javeau.ui.fw;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import net.nohaven.proj.javeau.crypt.prng.PRNG;

public abstract class LeftClickListener extends MouseAdapter {
	private int clicks;

	public LeftClickListener() {
		this(1);
	}

	public LeftClickListener(int clicks) {
		super();
		this.clicks = clicks;
	}

	public abstract void action(int x, int y, int clicks, int button);

	public void mouseReleased(MouseEvent e) {
		PRNG.getInstance().tick();

		if (e.getButton() != MouseEvent.BUTTON1 || e.getClickCount() != clicks)
			return;

		action(e.getX(), e.getY(), e.getClickCount(), e.getButton());
	}

}
